package me.fengzhuan.demo;

public class GoodsTest {
    public static void main(String[] args) {

        //1.创建数组
        Goods[] arr=new Goods[3];

        //2.创建商品对象
        Goods g1=new Goods("001","华为P40",5999,100);
        Goods g2=new Goods("002","保温杯",277.0,50);
        Goods g3=new Goods("003","枸杞",100.0,70);

        //3.将商品对象添加到数组中
        arr[0]=g1;
        arr[1]=g2;
        arr[2]=g3;

        //4.遍历数组
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i].getId()+" "+arr[i].getName()+" "+arr[i].getPrice()+" "+arr[i].getCount());
        }
    }
}
